#pragma once
#include "BoolCondUnit.h"
#include "ChartMultiData.h"
#include "SPUtil.h"

class CCheckDayIndex : public CBoolCondUnit
{
public:
	CCheckDayIndex()
	{
		CurIndex = -1;
		WantIndex = -1;
		GivenData = NULL;
	}
	~CCheckDayIndex();

	bool operator() ()
	{
		if (CurIndex < 0 || GivenData == NULL || WantIndex < 0)
			return false;
		if (WantIndex >= GivenData->E)
			return false;
		int curIndex = CSPUtil::GetDayIndex(CurIndex, GivenData);
		if (CurIndex >= WantIndex)
			return true;
		else
			return false;
	}

	bool operator() (int a_CurIndex)
	{
		if (a_CurIndex < 0 || GivenData == NULL || WantIndex < 0)
			return false;
		if (WantIndex >= GivenData->E)
			return false;
		int curDayIndex = CSPUtil::GetDayIndex(a_CurIndex, GivenData);
		if (curDayIndex >= WantIndex)
			return true;
		else
			return false;
	}
	CChartMultiData* GivenData;
	int CurIndex;
	int WantIndex;
};

